# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=freealut
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.1.0
pkgrel=1
pkgdesc="OpenAL Utility Toolkit (ALUT) (mingw-w64)"
arch=('any')
url="https://www.openal.org"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-openal")
_md5sums=e089b28a0267faabdb6c079ee173664a
source=("https://pkgs.fedoraproject.org/repo/pkgs/freealut/${_realname}-${pkgver}.tar.gz/${_md5sums}/${_realname}-${pkgver}.tar.gz")
sha256sums=('60d1ea8779471bb851b89b49ce44eecb78e46265be1a6e9320a28b100c8df44f')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  autoreconf -fiv
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
